<template>
  <div class="title-container extra-right">
    <h3 class="base-title">
      <slot v-if="$slots.default" />
      <template v-else>
        <span :class="leftLine ? 'left-line' : ''">
          <i></i>
          {{ title }}
        </span>
      </template>
    </h3>
    <div class="title-extra">
      <slot name="right" />
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      default: '标题'
    },
    leftLine: {
      type: Boolean,
      default: false
    }
  }
}
</script>
<style lang="scss" scoped>
.left-line {
  display: flex;
  height: 100%;
  align-items: center;

  i {
    vertical-align: top;
    display: inline-block;
    margin-right: 10px;
    height: 16px;
    width: 4px;
    border-radius: 2px;
    background-color: var(--huocms-com-color-primary);
  }
}

.left-icon {
  span {
    font-size: 14px;
    font-weight: bold;
    color: #52535c;
    line-height: 20px;
  }
}

.no-icon .icon-xiangqing {
  display: none;
}

i.icon-xiangqing {
  color: var(--huocms-com-color-primary);
  line-height: 20px;
  margin-right: 4px;
}

.baseTitle.title-container .base-title {
  font-size: 15px;
}

.title-container {
  padding: 0 0 10px;
  display: flex;

  ::v-deep {
    .el-form-item {
      margin-bottom: 0;
    }
  }

  &.extra-right {
    justify-content: space-between;
  }

  .title-extra {
    margin-left: 20px;
  }

  &.t20 {
    margin-top: 20px;
  }

  &.t10 {
    margin-top: 10px;
  }

  &.b20 {
    margin-bottom: 20px;
  }

  &.b10 {
    margin-bottom: 10px;
  }

  .base-title {
    position: relative;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    height: 22px;
    line-height: 22px;
    align-items: center;
    color: var(--suq-cn-color-title);
  }
}
</style>
